-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preset titles of duplicated templates and projects #4774
Preset titles of duplicated templates and projects #4774
Conversation
@@ -210,6 +210,7 @@ public String duplicate(Integer itemId) { | |||
try { | |||
this.baseProject = ServiceManager.getProjectService().getById(itemId); | |||
this.project = ServiceManager.getProjectService().duplicateProject(baseProject); | |||
this.setSaveDisabled(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is possible to do without "this" then leave it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Is that a coding guideline of us? We use "this" all the time to reference methods and properties of the current instance of a class (like the previous lines)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also find it unnecessary. I have also observed that you use this
a lot, and I often find it superfluous. The IDE marks class fields very clearly so that this
is no longer needed since color monitors came in use. I actually only use this
when setting class fields in constructors and setters, where the parameter has the same name as the field to set. At this point it is also not necessary to call the setter. Why not:
template = ServiceManager.getTemplateService().duplicateTemplate(baseTemplate);
assignedProjects.clear();
assignedProjects.addAll(template.getProjects());
saveDisabled = false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Atm it is not a guideline, but from my perspective it is redundant because you can also access current methods and variables without "this" keyword. Except for example ambiguity between instance variables and method parameters and such cases.
It is true that it is already used very often. I do not know this massive use from other projects but ok then I will approve the review if the test is successful and take the topic with me to clarify it.
@@ -111,6 +111,7 @@ public String duplicate(Integer itemId) { | |||
this.template = ServiceManager.getTemplateService().duplicateTemplate(baseTemplate); | |||
this.assignedProjects.clear(); | |||
this.assignedProjects.addAll(template.getProjects()); | |||
this.setSaveDisabled(false); | |||
return templateEditPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is possible to do without "this" then leave it out.
Resolves #3789